﻿@model IEnumerable<EdexApiClient.WH_COMPANIES>

@{
    ViewBag.Title = "Справочник компаний";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<header class="jumbotron subhead" id="overview">
    <h1></h1>
    <p class="lead">Справочник компаний</p>
</header>

<form>
    <div class="input-append">
        <input type="text" class="input-xxlarge" name="search" value="@Request["search"]" />
        <button class="btn" type="submit"><i class="icon-filter"></i> Фильтр</button>
    </div>
</form>

<table data-name="COMPANIES" class="table table-striped">
    <thead>
        <tr>
            <th>Код</th>
            <th>Наименование</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var record in Model) {
        <tr data-index="@record.GUID_RECORD">
            <td>@record.EXT_KEY</td>
            <td>@record.COMPANY_NAME</td>
        </tr>
        }
    </tbody>
</table>

<div id="company-details"></div>


<script type="text/javascript">

    $(function () {

        $("table[data-name='COMPANIES'] tr td[data-type!='noclick']").live("click", function () {

            var id = $(this).parent().attr("data-index");

            $("#company-details").load('/company/details/' + id, function () {
                $('.modal[data-name="COMPANIES"]').modal("show");
            });
        });
    });

</script>